package cn.hfuu.flink;

import java.io.Serializable;
import java.util.Objects;

/**
 * @author oldliu
 * @since 1.0
 */
public class WaterSensor implements Serializable {
    //编号，时间，和高度
    public String id;
    public Long ts;
    public Integer vc;//水位

    public WaterSensor() {
    }

    public WaterSensor(String id, Long ts, Integer vc) {
        this.id = id;
        this.ts = ts;
        this.vc = vc;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public Long getTs() {
        return ts;
    }

    public void setTs(Long ts) {
        this.ts = ts;
    }

    public Integer getVc() {
        return vc;
    }

    public void setVc(Integer vc) {
        this.vc = vc;
    }

    @Override
    public String toString() {
        return "水位信息{" +
                "站点='" + id + '\'' +
                ", 时间=" + new java.util.Date(ts) +
                ", 水位=" + vc +
                '}';
    }

//    @Override
//    public boolean equals(Object o) {
//        if (this == o) {
//            return true;
//        }
//        if (o == null || getClass() != o.getClass()) {
//            return false;
//        }
//        WaterSensor that = (WaterSensor) o;
//        return Objects.equals(id, that.id) &&
//                Objects.equals(ts, that.ts) &&
//                Objects.equals(vc, that.vc);
//    }
//
//    @Override
//    public int hashCode() {
//
//        return Objects.hash(id, ts, vc);
//    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        WaterSensor that = (WaterSensor) o;
        return Objects.equals(id, that.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}
